home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 1993 May / Info-Mac_II_May_1993.to_.sit / Info-Mac II (May 1993).toast / Technical / Serial Port Docs.txt < prev    next >
Internet Message Format  |  1992-08-29  |  10KB

  1. Date: Tue, 5 Dec 89 16:36:44 EST
  2. From: zben@umd5.umd.edu (Ben Cranston)
  3. Subject: Serial port document (long)
  4.  
  5. MIT EE claims it is benign but confusing.  Caveat Solderor...
  6.  
  7. This document contains notes on the Macintosh serial port and its use, with
  8. concentration on hardware interface issues.
  9.  
  10. ***  DANGER WARNING WILL ROBINSON!!!  ***
  11. The DB-25 on the back of a Macintosh is NOT a serial port!  It is a SCSI
  12. parallel port.  Any attempt to use this connector as a serial port will NOT
  13. function correctly and may cause damage to the Macintosh and/or the equipment
  14. being connected.
  15.  
  16. The two serial ports of a Macintosh are mini-Din-8 connectors which are
  17. labeled with a telephone (the "modem port") and a printer ("printer port").
  18. This is the pinout of the serial connectors.  We are looking at the back
  19. of the Macintosh (or alternatively at the BACK of a male plug):
  20.  
  21.              Macintosh Plus Serial Connectors (Mini-DIN-8)
  22.  
  23.        /------###------\         1 HSKo          Output Handshake
  24.      /        ###        \                        (Zilog 8530 DTR pin)
  25.    /                       \     2 HSKi / Clock  Input Handshake or extern clk
  26.   /     [|]   [|]   [|]     \                     (Depending on 8530 mode)
  27.  /       8     7     6       \   3 TxD-          Transmit data (minus)
  28. |                             |
  29. |                             |  4 Ground        Signal ground
  30. |     ===       ===    ===    |
  31. |      5         4      3     |  5 RxD-          Receive data (minus)
  32. |                             |
  33. |                             |  6 TxD+          Transmit data (plus)
  34.  \----+    ===   ===    +----/
  35.   \###|     2     1     |###/    7 N/C           (no connection)
  36.    \##|                 |##/
  37.      \|                 |/       8 RxD+          Receive data (plus)
  38.        \------###------/
  39.               ###
  40.  
  41. Note this is a RS-422 interface so the signals come in a balanced pair,
  42. a positive (plus) and a negative (minus), for each data signal.  As we shall
  43. see below, there is an easy method for matching this to RS-232.
  44.  
  45. We buy the mini-Din-8 connectors at our local electronics surplus store.
  46. They cost just under four dollars each, but are not quite as nice as the
  47. Apple molded plugs (for example, they don't have the nice orienting-D shape).
  48. We are now carefully removing the pins from the connector, soldering the wires
  49. to the pin, then replacing the pin in the connector body.  We fan out the
  50. end of the (stranded) wire into a little umbrella around the head of the pin,
  51. then we solder all around.  A "third hand" reduces this task from impossible
  52. to merely tedious.
  53.  
  54.  
  55. On the original 128K and the 512K upgrade machines (which have a DB-9 connector
  56. instead of the mini-Din-8) the Output Handshake line was held in a "marking"
  57. condition by hardware (a small resistor to the appropriate power supply rail).
  58. On later Macintoshes there are logic and a line driver for this line.  This
  59. change introduces the following incompatabilities:
  60.  
  61. 1. SOME of the older terminal programs don't have the code to explicitly
  62.    drive HSKo high.
  63.  
  64. 2. SOME terminal programs drop HSKo when they close down.
  65.  
  66. 3. SOME modems require DTR and will drop carrier if DTR goes away.
  67.  
  68. If the cable design given below, mapping HSKo to DTR, is used, there are two
  69. recognized pathological conditions which can happen:
  70.  
  71. A. Cannot use modem at all, because of 1 and 3 together.
  72.  
  73. B. Modem drops out when switching between terminal programs, 2 and 3 together.
  74.  
  75. Of course, some people consider B a feature, in that it will hang up the
  76. phone when you switch off the computer.  Personally, I hang up the phone when
  77. I am done and I like to switch from terminal program to terminal program.
  78. If one of the above conditions happen, there are only three alternatives.
  79.  
  80. I.   If at ALL possible, set your modem up to IGNORE DTR and stay connected.
  81.      Look for a DIP switch for this.  I personally made this choice.
  82.    
  83. II.  Use only terminal programs which "properly" drive HSKo.
  84.      You get to operationally define "properly" :-)
  85.  
  86. III. Drive DTR from DSR at the modem end of the cable, as described below.
  87.  
  88.  
  89. Macintosh to modem (or other DCE device):
  90.  
  91.        DIN-8 MALE                       DB-25 MALE
  92.  
  93.        GROUND 4 O--+--------------------O 7  GROUND
  94.   RECV DATA + 8 O--+
  95.  
  96.   RECV DATA - 5 O-----------------------O 3  RD (Receive Data)
  97.   
  98.   XMIT DATA - 3 O-----------------------O 2  TD (Transmit Data)
  99.   
  100. HANDSHAKE OUT 1 O--+
  101. HANDSHAKE  IN 2 O--+--------------------O 20 DTR (Data Terminal Ready)
  102.  
  103. Note that in RS-232 the data signals are inverted (marking is minus) while
  104. the control signals are not (marking is plus).  Thus the transmit data
  105. minus signal from the Mac is just right for driving the modem.  Leave the
  106. transmit data plus signal disconnected.  If you ground this you will short
  107. out a driver, and it will probably get hot.  Similarly the receive data
  108. signal from the modem/DCE is inverted, so it can drive the Mac's receive
  109. data minus line, but in this case the receive data plus line is grounded to
  110. prevent any extraneous signals from being induced into the circuit.
  111.  
  112. Note also that we are driving both HSKi and DTR from HSKo so the problems
  113. described above can happen.  An alternative arrangement would drive these
  114. signals from the modem/DCE's source of DSR, like this:
  115.   
  116.                                      +--O 6  DSR (Data Set Ready)
  117. HANDSHAKE  IN 2 O--------------------+--O 20 DTR (Data Terminal Ready)
  118.  
  119. Some dumb modems might require Request To Send (RTS) which one would wire
  120. like this:
  121.  
  122.                                      +--O 6  DSR (Data Set Ready)
  123. HANDSHAKE  IN 2 O--------------------+--O 20 DTR (Data Terminal Ready)
  124.                                      +--O 4  RTS (Request To Send)
  125.  
  126. Finally, if you have only 3-wire cable and don't need DTR handshake, you
  127. can wire each side to be happy like this:
  128.  
  129. HANDSHAKE OUT 1 O--+                 +--O 6  DSR (Data Set Ready)
  130. HANDSHAKE  IN 2 O--+                 +--O 20 DTR (Data Terminal Ready)
  131.                                      +--O 4  RTS (Request To Send)
  132.  
  133.  
  134. Macintosh to terminal (or other DTE device):
  135.  
  136.        DIN-8 MALE                      DB-25 FEMALE
  137.  
  138.        GROUND 4 O--+--------------------O 7  GROUND
  139.   RECV DATA + 8 O--+
  140.   
  141.   RECV DATA - 5 O-----------------------O 2  TD (Transmit Data)
  142.   
  143.   XMIT DATA - 3 O-----------------------O 3  RD (Recieve Data)
  144.   
  145. HANDSHAKE  IN 2 O-----------------------O 20 DTR (Data Terminal Ready)
  146.  
  147. The same analysis applies with respect to the data signals, except that
  148. in this case the transmit and receive are switched around, since one guy's
  149. transmit should be the other guy's receive and vice versa.  Note receive
  150. data plus is grounded while transmit data plus is left disconnected.
  151.  
  152. For this particular cable we have wired the terminal/DTE's DTR back into
  153. the Macintoshes HSKi to implement a hardware handshake.  Assume the
  154. terminal side is a printer that is being overrun.  One of the things these
  155. printers can do is drop DTR.  By wiring it through to the handshake input
  156. we make it possible for the Macintosh software to temporarily pause in
  157. sending, until the printer's buffers empty out and the printer reasserts
  158. the DTR signal.
  159.  
  160. Some terminal devices may need to see DSR (Data Set Ready) or CD
  161. (Carrier Detect) or CTS (Clear to Send), in which case they may be driven
  162. >From an appropriate source.
  163.  
  164.                                      +--O 20 DTR (Data Terminal Ready)
  165. This is probably appropriate         +--O 6  DSR (Data Set Ready)
  166. for a communications terminal        +--O 8  CD  (Carrier Detect)
  167. in which DTR is a totally static                     
  168. signal and does not move.            +--O 4  RTS (Request To Send)
  169.                                      +--O 5  CTS (Clear To Send)
  170.  
  171. or
  172.  
  173.                                      +--O 4  RTS (Request To Send)
  174. This is probably appropriate         +--O 6  DSR (Data Set Ready)
  175. for a printer that flaps DTR         +--O 5  CTS (Clear To Send)
  176. as the buffer fills and empties.     +--O 8  CD  (Carrier Detect)
  177.                      
  178. The logic is to drive from whichever of DTR or RTS is NOT flapping around
  179. as buffers fill and empty or as the terminal transmits and receives...
  180.  
  181. To connect directly to an IBM PC we believe CD must be asserted.  That is,
  182. an IBM PC will not accept data unless it also sees the CD signal.
  183.  
  184.  
  185. 128K/512K MACINTOSH
  186.  
  187. Somebody on comp.sys.mac.hardware asked for cables for a 128K/512K Mac!
  188. I didn't know there were any more of those out there!!!  :-)  Here are
  189. the corresponding connections, please use these in conjunction with the
  190. analysis and suggestions provided above:
  191.  
  192.  
  193. 128K/512K Macintosh to modem (or other DCE device):
  194.  
  195.       DB-9 MALE                       DB-25 MALE
  196.  
  197.      GROUND 3 O--+--------------------O 7  GROUND
  198. RECV DATA + 8 O--+
  199.  
  200. RECV DATA - 9 O-----------------------O 3  RD (Receive Data)
  201.   
  202. XMIT DATA - 5 O-----------------------O 2  TD (Transmit Data)
  203.   
  204.  + 12 Volts 6 O--+
  205.   HANDSHAKE 7 O--+--------------------O 20 DTR (Data Terminal Ready)
  206.  
  207.  
  208. 128K/512K Macintosh to terminal (or other DTE device):
  209.  
  210.       DB-9 MALE                       DB-25 FEMALE
  211.  
  212.      GROUND 3 O--+--------------------O 7  GROUND
  213. RECV DATA + 8 O--+
  214.  
  215. RECV DATA - 9 O-----------------------O 2  TD (Transmit Data)
  216.   
  217. XMIT DATA - 5 O-----------------------O 3  RD (Receive Data)
  218.   
  219.   HANDSHAKE 7 O-----------------------O 20 DTR (Data Terminal Ready)
  220.  
  221.  
  222. FINAL CLOSURE
  223.  
  224. On the DB-25 pin 1 is the FRAME ground and pin 7 is the SIGNAL ground.
  225. Equipment that requires connection to pin 1 is badly designed (IMHO).
  226. As a very last resort you might try a 1 to 7 jumper.
  227.  
  228. As you can imagine from seeing all these alternatives, an RS232 breakout
  229. box is real handy, since you can try all these patches without having to
  230. warm up a soldering iron.  The only other thing I can say is:
  231.  
  232. IF IT DON'T WORK, DON'T LEAVE IT TURNED ON LONG ENOUGH TO GET HOT!
  233.  
  234. Communications driver chips are built very ruggedly and will stand an
  235. amazing amount of mistreatment for a short period of time.  But if you
  236. let two drivers fight for an hour one or both of them will burn out...
  237.  
  238. I've read this over a dozen times to make sure there aren't any totally
  239. glaring errors, but I cannot be responsible for anybody's smoked hardware.
  240. Let's be careful out there!
  241.  
  242. Ben Cranston <zben@Trantor.UMD.EDU>
  243. Network Infrastructures Group
  244. Computer Science Center
  245. University of Maryland at College Park
  246. of Ulm
  247.  
  248.